#!/bin/bash
# filename: /tmp/mydir/target_ip.txt
#
for ips in `cat /tmp/mydir/target_ip.txt`
do
        result=`ping -w 2 -c 3 ${ips} | grep packet | awk -F" " '{print $6}'| awk -F"%" '{print $1}'| awk -F' ' '{print $1}'`
        if [ $result -eq 0 ]; then
                echo ""${ips}" is ok !"
        else
                echo ""${ips}" is not connected ....."
        fi

done